package exception;

import java.io.FileOutputStream;
import java.io.IOException;

/**异常处理在IO中的应用*/
public class FinalDemo3 {
    public static void main(String[] args) {
        FileOutputStream fos=null;
        try{
            fos=new FileOutputStream("test.txt");
            fos.write(1);
        }catch(Exception e){
            System.out.println("异常处理");
        }finally {
            try {
                if(fos!=null){
                    fos.close();
                }
            } catch (IOException e) {
                System.out.println("出错了");
            }
        }
    }
}
